<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>map方法</title>
    <script>
        let arr = [1, -20, 63, -444, 12];
        //正数不变，负数变为0
        //map中传入一个回调方法，此方法表达数组中每个元素的运算的方式
        //不会改变原数组
        let numbers = arr.map(element => element < 0 ? element = 0 : element);
        console.log(arr);
        console.log(numbers);

    </script>
</head>
<body>

</body>
</html>